#ifndef MEDICSMODEL_H
#define MEDICSMODEL_H
#include <QtSql>
#include <QAbstractListModel>



class MedicsModel : public QAbstractListModel
{
    Q_OBJECT
    Q_PROPERTY (bool isLoading READ isLoading WRITE setIsLoading NOTIFY isLoadingChanged)
    enum {DenominationRole = Qt::UserRole+1 , FormeRole,CodeRole};
public:
    explicit MedicsModel(QObject *parent = 0);
    int rowCount(const QModelIndex &parent) const;
    QVariant data(const QModelIndex &index, int role) const;
    Q_INVOKABLE void load(const QString& filter);
    Q_INVOKABLE void setQuery(const QString& q);


    bool isLoading(){return mIsLoading;}
    void setIsLoading(bool value);


signals:
    void isLoadingChanged();

private:
    QList<QSqlRecord> mDatas;
    bool mIsLoading;

    
};

#endif // MEDICSMODEL_H
